import request from '@/utils/request'
const BASE_API = process.env.BASE_API;

//json序列化
function serialize(data) {
  let val = '';
  let temp = '?';
  var num = 0;
  for(let k in data){
    num ++;
    temp += k+"="+data[k]+"&"
  }
  if(num==0){
    val = ''
  }
  else{
    val = temp.slice(0,temp.length-1);
  }
  return val;
}

export const MH_API = {
  //七牛外链地址
  QN_url: 'http://meihe.shuxing.net.cn/',
  aliPay: BASE_API + '/Hongniang/Trade/payMent?pay_type=Alipay',
  wxPay: BASE_API + '/Hongniang/Trade/payMent?pay_type=Wxpay',

  // 登录
  serverLogin (params) {
    return request({
      url: `${BASE_API}/Hongniang/Login/login`+serialize(params),
      method: 'post',
      data: {}
    })
  },
  // 注册
  serverRegist (params) {
    return request({
      url: `${BASE_API}/Hongniang/Login/register`+serialize(params),
      method: 'post',
      data: {}
    })
  },
  // 发送验证码
  sendCode (params) {
    return request({
      url: `${BASE_API}/Hongniang/User/sendCode`+serialize(params),
      method: 'post',
      data: {}
    })
  },
  // 完善资料
  perfectInfo (params) {
    return request({
      url: `${BASE_API}/Hongniang/Login/perfectInformation`+serialize(params),
      method: 'post',
      data: {}
    })
  },
  //刷线token
  refresh_token (params) {
    return request({
      url: `${BASE_API}/Hongniang/Login/refresh_token`+serialize(params),
      method: 'post',
      data: {}
    })
  },
  //获取用户信息
  getMember (params) {
    return request({
      url: `${BASE_API}/Hongniang/User/getUser`+serialize(params),
      method: 'get',
      data: {}
    })
  },

  // 上传图片
  uploadImg (params) {
    return request({
      url: `http://upload.qiniu.com`,
      method: 'post',
      cache: false,
      contentType: false,
      processData: false,
      data: params
    })
  },
  // 送礼物
  putGifts (params) {
    return request({
      url: `${BASE_API}/Hongniang/User/putGifts`+serialize(params),
      method: 'post',
      data: {}
    })
  },  
  //  我收到的礼物列表
  getGift (params) {
    return request({
      url: `${BASE_API}/Hongniang/Login/myGift`+serialize(params),
      method: 'post',
      data: {}
    })
  },  
  //  红娘活动列表
  getActives (params) {
    return request({
      url: `${BASE_API}/Hongniang/Activity/getActivitys`+serialize(params),
      method: 'get',
      data: {}
    })
  },
  //  网友活动列表
  getHongniang (params) {
    return request({
      url: `${BASE_API}/Hongniang/User/getHongniangs`+serialize(params),
      method: 'get',
      data: {}
    })
  },
  //  活动详情
  viewActives (params) {
    return request({
      url: `${BASE_API}/Hongniang/Activity/getActivity`+serialize(params),
      method: 'get',
      data: {}
    })
  },
  //发布活动
  releaseActivity (params) {
    return request({
      url: `${BASE_API}/Hongniang/Activity/releaseActivity`+serialize(params),
      method: 'post',
      data: {}
    })
  },
  //编辑活动
  editActivity (params) {
    return request({
      url: `${BASE_API}/Hongniang/Activity/editActivity`+serialize(params),
      method: 'post',
      data: {}
    })
  },
  //活动已报名列表
  getActivitySignup (params) {
    return request({
      url: `${BASE_API}/Hongniang/Activity/getActivitySignup`+serialize(params),
      method: 'get',
      data: {}
    })
  },
  //活动模板列表
  getActivityTemplets (params) {
    return request({
      url: `${BASE_API}/Hongniang/Activity/getActivityTemplets`+serialize(params),
      method: 'get',
      data: {}
    })
  },

  //下单
  createOrder (params){
    return request({
      url: `${BASE_API}/Hongniang/Trade/buy`+serialize(params),
      method: 'post',
      data: {}
    })
  },
  //订单列表
  orderList (params) {
    return request({
      url: `${BASE_API}/Hongniang/Trade/getTrades`+serialize(params),
      method: 'get',
      data: {}
    })
  },
  //订单详情
  getTradeInfo (params) {
    return request({
      url: `${BASE_API}/Hongniang/Trade/getTradeInfo`+serialize(params),
      method: 'get',
      data: {}
    })
  },
  //关闭订单
  closeOrder (params) {
    return request({
      url: `${BASE_API}/Hongniang/Trade/closeOder`+serialize(params),
      method: 'post',
      data: {}
    })
  },

  //商品列表
  goodsList (params) {
    return request({
      url: `${BASE_API}/Hongniang/Trade/getGoodss`+serialize(params),
      method: 'get',
      data: {}
    })
  },
  //商品详情
  getGoods (params) {
    return request({
      url: `${BASE_API}/Hongniang/Trade/getGoods`+serialize(params),
      method: 'get',
      data: {}
    })
  },
  //发布商品
  releaseGoods (params) {
    return request({
      url: `${BASE_API}/Hongniang/Trade/releaseGoods`+serialize(params),
      method: 'post',
      data: {}
    })
  },

  //我的动态
  twitterList (params) {
    return request({
      url: `${BASE_API}/Hongniang/User/myTwitter`+serialize(params),
      method: 'get',
      data: {}
    })
  },
  //发布动态
  sendTwitter (params) {
    return request({
      url: `${BASE_API}/Hongniang/User/releaseSomething`+serialize(params),
      method: 'post',
      data: {}
    })
  },
  //动态列表
  getTwitters (params) {
    return request({
      url: `${BASE_API}/Hongniang/User/getTwitters`+serialize(params),
      method: 'get',
      data: {}
    })
  },
  //网友列表
  getUsers (params) {
    return request({
      url: `${BASE_API}/Hongniang/User/getUsers`+serialize(params),
      method: 'get',
      data: {}
    })
  },

  //首页
  getIndexData (params) {
    return request({
      url: `${BASE_API}/Hongniang/User/getIndex`+serialize(params),
      method: 'get',
      data: {}
    })
  },
  //打赏
  clickReward (params) {
    return request({
      url: `${BASE_API}/Hongniang/User/putGratuity`+serialize(params),
      method: 'post',
      data: {}
    })
  },
  //设置打赏金额
  setMoney (params) {
    return request({
      url: `${BASE_API}/Hongniang/Login/setMoney`+serialize(params),
      method: 'post',
      data: {}
    })
  },
  //喜欢
  clickLove (params) {
    return request({
      url: `${BASE_API}/Hongniang/User/clickLove`+serialize(params),
      method: 'post',
      data: {}
    })
  },
  //网友信息
  getUserInfo (params) {
    return request({
      url: `${BASE_API}/Hongniang/User/getUserInfo`+serialize(params),
      method: 'get',
      data: {}
    })
  },
  //才艺列表
  getTalent (params) {
    return request({
      url: `${BASE_API}/Hongniang/User/getTalent`+serialize(params),
      method: 'get',
      data: {}
    })
  },
  //才艺详情
  getTalentInfo (params) {
    return request({
      url: `${BASE_API}/Hongniang/User/getTalentInfo`+serialize(params),
      method: 'get',
      data: {}
    })
  },
  //发布才艺
  addTalent (params) {
    return request({
      url: `${BASE_API}/Hongniang/User/publishSkill`+serialize(params),
      method: 'post',
      data: {}
    })
  },

  //获取投票列表
  getVoteList(params){
    return request({
      url: `${BASE_API}/Hongniang/Activity/getVotes`+serialize(params),
      method: 'get',
      data: {}
    })
  },
  //提交投票
  confirmVote(params){
    return request({
      url: `${BASE_API}/Hongniang/Activity/confirmVote`+serialize(params),
      method: 'post',
      data: {}
    })
  },
  //发布投票
  getActivitySignup(params){
    return request({
      url: `${BASE_API}/Hongniang/Activity/getActivitySignup`+serialize(params),
      method: 'post',
      data: {}
    })
  },

  //我的备注
  getRemarks (params) {
    return request({
      url: `${BASE_API}/Hongniang/User/getRemarks`+serialize(params),
      method: 'get',
      data: {}
    })
  },
  //添加备注
  addRemarks (params) {
    return request({
      url: `${BASE_API}/Hongniang/User/addRemarks`+serialize(params),
      method: 'post',
      data: {}
    })
  },
  //添加个人介绍
  addIntroduction (params) {
    return request({
      url: `${BASE_API}/Hongniang/User/addIntroduction`+serialize(params),
      method: 'post',
      data: {}
    })
  },
  //编辑资料
  editInfo (params) {
    return request({
      url: `${BASE_API}/Hongniang/User/editUser`,
      method: 'post',
      data: params
    })
  },
  //申请为红娘
  applyHong (params) {
    return request({
      url: `${BASE_API}/Hongniang/User/applyHong`+serialize(params),
      method: 'post',
      data: {}
    })
  },
  //我的相册
  getAlbums (params) {
    return request({
      url: `${BASE_API}/Hongniang/User/getAlbums`+serialize(params),
      method: 'get',
      data: {}
    })
  },
  //拉黑名单
  getLahei (params) {
    return request({
      url: `${BASE_API}/Hongniang/User/getLahei`+serialize(params),
      method: 'get',
      data: {}
    })
  },
  //举报
  toReport (params) {
    return request({
      url: `${BASE_API}/Hongniang/User/addReport`+serialize(params),
      method: 'post',
      data: {}
    })
  },
  //意见反馈
  addFeedback (params) {
    return request({
      url: `${BASE_API}/Hongniang/User/addFeedback`+serialize(params),
      method: 'post',
      data: {}
    })
  },
  //修改密码
  updatePassword (params) {
    return request({
      url: `${BASE_API}/Hongniang/User/updatePassword`+serialize(params),
      method: 'post',
      data: {}
    })
  },
  //申请注销
  applyCancel (params) {
    return request({
      url: `${BASE_API}/Hongniang/User/applyCancel`+serialize(params),
      method: 'post',
      data: {}
    })
  },

  //财富认证
  applyCaifu (params) {
    return request({
      url: `${BASE_API}/Hongniang/User/applyCaifu`+serialize(params),
      method: 'post',
      data: {}
    })
  },
  //车辆认证
  applyCar (params) {
    return request({
      url: `${BASE_API}/Hongniang/User/applyCar`+serialize(params),
      method: 'post',
      data: {}
    })
  },
  //学历认证
  applyEducation (params) {
    return request({
      url: `${BASE_API}/Hongniang/User/applyEducation`+serialize(params),
      method: 'post',
      data: {}
    })
  },
  //实名认证
  applyRealName (params) {
    return request({
      url: `${BASE_API}/Hongniang/User/applyRealName`+serialize(params),
      method: 'post',
      data: {}
    })
  },

  //喜欢我的
  getLoveList (params) {
    return request({
      url: `${BASE_API}/Hongniang/User/myLoveList`+serialize(params),
      method: 'get',
      data: {}
    })
  },
  //我喜欢的
  getMyLove (params) {
    return request({
      url: `${BASE_API}/Hongniang/User/myLove`+serialize(params),
      method: 'get',
      data: {}
    })
  },
  //谁看过我
  getSeenList (params) {
    return request({
      url: `${BASE_API}/Hongniang/User/getSeenList`+serialize(params),
      method: 'get',
      data: {}
    })
  },
  //互相喜欢
  getMutualLove (params) {
    return request({
      url: `${BASE_API}/Hongniang/User/getMutualLove`+serialize(params),
      method: 'get',
      data: {}
    })
  },

  //融云token
  getToken (params){
    return request({
      url: `${BASE_API}/Hongniang/Rongyun/getToken`+serialize(params),
      method: 'get',
      data: {}
    })
  },

  //下线列表
  getSubordinate (params){
    return request({
      url: `${BASE_API}/Hongniang/User/getSubordinate`+serialize(params),
      method: 'get',
      data: {}
    })
  },
  //我的匹配
  getTryst (params) {
    return request({
      url: `${BASE_API}/Hongniang/Tryst/getTryst`+serialize(params),
      method: 'get',
      data: {}
    })
  },
  //匹配详情
  getTrystInfo (params) {
    return request({
      url: `${BASE_API}/Hongniang/Tryst//getTrystInfo`+serialize(params),
      method: 'get',
      data: {}
    })
  },
  //发起匹配
  releaseTryst (params) {
    return request({
      url: `${BASE_API}/Hongniang/Tryst/releaseTryst`+serialize(params),
      method: 'post',
      data: {}
    })
  },
  //接受或拒绝匹配
  acceptTryst (params) {
    return request({
      url: `${BASE_API}/Hongniang/Tryst/acceptTryst`+serialize(params),
      method: 'post',
      data: {}
    })
  },
  //确认约会地点
  confirmTryst (params) {
    return request({
      url: `${BASE_API}/Hongniang/Tryst/confirmTryst`+serialize(params),
      method: 'post',
      data: {}
    })
  },

  //确认收货
  confirmReceiving (params) {
    return request({
      url: `${BASE_API}/Hongniang/Trade/confirmReceiving`+serialize(params),
      method: 'post',
      data: {}
    })
  },
  //删除地址
  delAddress (params) {
    return request({
      url: `${BASE_API}/Hongniang/Trade/delAddress`+serialize(params),
      method: 'post',
      data: {}
    })
  },
  //设为默认地址
  defaultAddress (params) {
    return request({
      url: `${BASE_API}/Hongniang/Trade/defaultAddress`+serialize(params),
      method: 'post',
      data: {}
    })
  },
  //获取地址列表
  getAddresss (params) {
    return request({
      url: `${BASE_API}/Hongniang/Trade/getAddresss`+serialize(params),
      method: 'get',
      data: {}
    })
  },
  //获取单个地址
  getAddress (params) {
    return request({
      url: `${BASE_API}/Hongniang/Trade/getAddress`+serialize(params),
      method: 'get',
      data: {}
    })
  },
  //编辑地址
  editAddress (params) {
    return request({
      url: `${BASE_API}/Hongniang/Trade/editAddress`+serialize(params),
      method: 'post',
      data: {}
    })
  },
  //添加地址
  addAddress (params) {
    return request({
      url: `${BASE_API}/Hongniang/Trade/addAddress`+serialize(params),
      method: 'post',
      data: {}
    })
  },
  //添加物流信息
  deliveryOrder (params) {
    return request({
      url: `${BASE_API}/Hongniang/Trade/deliveryOrder`+serialize(params),
      method: 'post',
      data: {}
    })
  },
  //审核退款信息
  examineRefund (params) {
    return request({
      url: `${BASE_API}/Hongniang/Trade/examineRefund`+serialize(params),
      method: 'post',
      data: {}
    })
  },
  //查看退款信息
  seeRefund (params) {
    return request({
      url: `${BASE_API}/Hongniang/Trade/seeRefund`+serialize(params),
      method: 'post',
      data: {}
    })
  },
  //申请退款
  applyRefund (params) {
    return request({
      url: `${BASE_API}/Hongniang/Trade/applyRefund`+serialize(params),
      method: 'post',
      data: {}
    })
  },

  //网友审核列表
  getUserList (params) {
    return request({
      url: `${BASE_API}/Hongniang/Examine/getUserList`+serialize(params),
      method: 'get',
      data: {}
    })
  },
  //网友审核
  examineUser (params) {
    return request({
      url: `${BASE_API}/Hongniang/Examine/examineUser`+serialize(params),
      method: 'post',
      data: {}
    })
  },

  //产品审核列表
  getGoodsList (params) {
    return request({
      url: `${BASE_API}/Hongniang/Examine/getGoodsList`+serialize(params),
      method: 'get',
      data: {}
    })
  },
  //产品审核
  examineGoods (params) {
    return request({
      url: `${BASE_API}/Hongniang/Examine/examineGoods`+serialize(params),
      method: 'post',
      data: {}
    })
  },
  //红娘审核列表
  getHongList (params) {
    return request({
      url: `${BASE_API}/Hongniang/Examine/getHongList`+serialize(params),
      method: 'get',
      data: {}
    })
  },
  //红娘审核
  examineHong (params) {
    return request({
      url: `${BASE_API}/Hongniang/Examine/examineHong`+serialize(params),
      method: 'post',
      data: {}
    })
  },
  //活动审核列表
  getActivityList (params) {
    return request({
      url: `${BASE_API}/Hongniang/Examine/getActivityList`+serialize(params),
      method: 'get',
      data: {}
    })
  },
  //活动审核
  examineActivity (params) {
    return request({
      url: `${BASE_API}/Hongniang/Examine/examineActivity`+serialize(params),
      method: 'post',
      data: {}
    })
  },

  //活动报名
  putActivity (params) {
    return request({
      url: `${BASE_API}/Hongniang/Activity/putActivity`+serialize(params),
      method: 'post',
      data: {}
    })
  },
  //账单明细
  getBillList (params) {
    return request({
      url: `${BASE_API}/Hongniang/User/getBillList`+serialize(params),
      method: 'get',
      data: {}
    })
  },
  hongNiangList (params) {
    return request({
      url: `${BASE_API}/Hongniang/User/getHongNiang`+serialize(params),
      method: 'get',
      data: {}
    })
  },
  //查看余额
  getBalance (params) {
    return request({
      url: `${BASE_API}/Hongniang/User/getBalance`+serialize(params),
      method: 'get',
      data: {}
    })
  },
  //余额支付
  balancePay(params){
    return request({
      url: `${BASE_API}/Hongniang/Trade/pay`+serialize(params),
      method: 'post',
      data: {}
    })
  },
  //广告
  getGuanggao (params) {
    return request({
      url: `${BASE_API}/Hongniang/Activity/getGuanggao`+serialize(params),
      method: 'get',
      data: {}
    })
  },
  //我的审核记录
  myExamList (params) {
    return request({
      url: `${BASE_API}/Hongniang/Examine/myExamList`+serialize(params),
      method: 'get',
      data: {}
    })
  },
  //服务协议type=1 服务条款type=2
  getAgreement (params) {
    return request({
      url: `${BASE_API}/Hongniang/Service/getAgreement`+serialize(params),
      method: 'get',
      data: {}
    })
  },
  //可提现金额
  getUserCash (params) {
    return request({
      url: `${BASE_API}/Hongniang/User/getUserCash`+serialize(params),
      method: 'get',
      data: {}
    })
  },
  //申请提现
  applyCash (params) {
    return request({
      url: `${BASE_API}/Hongniang/User/applyCash`+serialize(params),
      method: 'post',
      data: {}
    })
  },
  //绑定提现账号
  bindAccount (params) {
    return request({
      url: `${BASE_API}/Hongniang/User/bindingAccount`+serialize(params),
      method: 'post',
      data: {}
    })
  },
  //提现账户列表
  getAccount (params) {
    return request({
      url: `${BASE_API}/Hongniang/User/getAccount`+serialize(params),
      method: 'get',
      data: {}
    })
  },
  //推送
  putMsg (params) {
    return request({
      url: `${BASE_API}/Hongniang/User/putMsg`+serialize(params),
      method: 'post',
      data: {}
    })
  },

  //颜值
  putAppearance (params) {
    return request({
      url: `${BASE_API}/Hongniang/User/putAppearance`+serialize(params),
      method: 'post',
      data: {}
    })
  },
  getScoring (params) {
    return request({
      url: `${BASE_API}/Hongniang/Examine/getScoring`+serialize(params),
      method: 'get',
      data: {}
    })
  },
  putScoring (params) {
    return request({
      url: `${BASE_API}/Hongniang/Examine/putScoring`+serialize(params),
      method: 'post',
      data: {}
    })
  },
  //跨城
  opening (params) {
    return request({
      url: `${BASE_API}/Hongniang/Trade/Opening`+serialize(params),
      method: 'post',
      data: {}
    })
  },
  //活动签到
  activeSign (params) {
    return request({
      url: `${BASE_API}/Hongniang/Activity/Sign`+serialize(params),
      method: 'post',
      data: {}
    })
  },
  //经纬度
  putPosition (params) {
    return request({
      url: `${BASE_API}/Hongniang/User/putPosition`+serialize(params),
      method: 'post',
      data: {}
    })
  },
  //敏感词
  getSensitive (params) {
    return request({
      url: `${BASE_API}/Hongniang/Service/getSensitive`+serialize(params),
      method: 'get',
      data: {}
    })
  },
  
};
